# coding:utf8
from app import app
from flask_script import Manager
from flasgger import Swagger
from flask import Flask, session
from flask_session import Session

manage = Manager(app)

template = {
  "swagger": "2.0",
  "info": {
    "title": "操作文档",
    "description": "管理系统文档",
    "contact": {
      "responsibleOrganization": "东莞农村商业银行",
      "responsibleDeveloper": "东莞农村商业银行",
      "email": "429504198@qq.com",
      "url": "www.drcbank.com",
    },
  },
  "host": "10.8.205.72:6001",  # overrides localhost:500
  "basePath": "/",  # base bash for blueprint registration
  "schemes": [
    "http",
    "https"
  ],
  "operationId": "getmyData"
}
swagger = Swagger(app,template=template)


if __name__ == "__main__":
    app.secret_key = 'xxxx'
    app.config['SESSION_TYPE'] = 'filesystem'  # session类型为redis
    app.config['SESSION_FILE_DIR'] = './session'  # session类型为redis
    app.config['SESSION_FILE_THRESHOLD'] = 500  # 存储session的个数如果大于这个值时，就要开始进行删除了
    app.config['SESSION_FILE_MODE'] = 384  # 文件权限类型

    app.config['SESSION_PERMANENT'] = False  # 如果设置为True，则关闭浏览器session就失效。
    app.config['SESSION_USE_SIGNER'] = False  # 是否对发送到浏览器上session的cookie值进行加密
    app.config['SESSION_KEY_PREFIX'] = 'session:'  # 保存到session中的值的前缀
    Session(app)

    app.debug = True
    app.run(host='0.0.0.0',port=6001)